<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();

	/*	$sql="select *  from " . tablename("cjdc_user") ." WHERE  name LIKE :name  and uniacid=:uniacid";
	$list=pdo_fetchall($sql,array(':name'=>$where,'uniacid'=>$_W['uniacid']));*/
$type = $_GPC['type']?$_GPC['type']:0;
$data[':uniacid']=$_W['uniacid'];
$where = ' where uniacid=:uniacid';
if(!empty($_GPC['type'])){
    $data[':type']=$type;
    $where .= " and type=:type";
}
if($_GPC['time']){
    $start=strtotime(date('Y-m-d',strtotime($_GPC['time']['start'])));
    $end=strtotime(date('Y-m-d',strtotime($_GPC['time']['end'])));
    $where.=" and create_time >={$start} and create_time <={$end}";
}
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$sql="select *  from " . tablename("cjdc_yyystatistics") .$where." order by id DESC";
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql,$data);
if(!empty($list)){
    foreach ($list as $key=>$value){
        if($value['type'] == 1){
            $list[$key]['type'] = '免费摇';
        }elseif ($value['type'] == 2){
            $list[$key]['type'] = '1元摇';
        }elseif ($value['type'] == 3){
            $list[$key]['type'] = '会员摇';
        }elseif ($value['type'] == 4){
            $list[$key]['type'] = '9.9元摇';
        }elseif ($value['type'] == 5){
            $list[$key]['type'] = '39元摇';
        }elseif ($value['type'] == 6){
            $list[$key]['type'] = '99元摇';
        }
        $list[$key]['create_time'] = date('Y-m-d',$value['create_time']);
    }
}
$total=pdo_fetchcolumn("select count(*) from " . tablename("cjdc_yyystatistics") .$where,$data);
$pager = pagination($total, $pageindex, $pagesize);
include $this->template('web/yyy');